// 
//  JKLrcLineCell.m
//  QQMusic
// 
//  Created by albert on 16/4/9.
//  Copyright (c) 2016年 albert. All rights reserved.
// 

#import "JKLrcLineCell.h"
#import "JKLrcLabel.h"
#import "Masonry.h"

@implementation JKLrcLineCell

static NSString * const lrcId = @"lrc";

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        JKLrcLabel *lrcLabel = [[JKLrcLabel alloc] init];
        lrcLabel.textColor = [UIColor whiteColor];
        lrcLabel.textAlignment = NSTextAlignmentCenter;
        lrcLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:lrcLabel];
        _lrcLabel = lrcLabel;
        self.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        // 让歌词label居中
        lrcLabel.translatesAutoresizingMaskIntoConstraints = NO;
        [lrcLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self.contentView);
        }];
    }
    return self;
}

+ (instancetype)lrcLineCellWithTableView:(UITableView *)tableView{
    JKLrcLineCell *cell = [tableView dequeueReusableCellWithIdentifier:lrcId];
    if (cell == nil) {
        cell = [[JKLrcLineCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:lrcId];
    }
    return cell;
}
@end
